package com.longteng.diamond.job;


import lombok.extern.slf4j.Slf4j;
import org.apache.log4j.Logger;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.utils.Key;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by Administrator
 * DATE : 2018/7/22
 * TIME : 22:47
 * PROJECT : java-lesson
 * PACKAGE : com.longteng.lesson
 *
 * @author <a href="mailto:taki@qq.com">Administrator</a>
 */

@Slf4j
public class QuartzJob implements Job {

    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        System.out.println("到下午3点了，我要去上课了");
        System.out.println("执行测试计划的方法没有写呢");

        Key key = jobExecutionContext.getJobDetail().getKey();
        System.out.println("group:" + key.getGroup());
        System.out.println("Name:" + key.getName());
        log.info(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "★★★★★★★★★★★");
        System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "★★★★★★★★★★★");
//        WriteBuild writeBuild = new WriteBuild(key.getName());
//        Thread thread = new Thread(writeBuild);
//        thread.start();
    }


    private class WriteBuild implements Runnable {
        private String jobName;

        public WriteBuild(String jobName) {
            this.jobName = jobName;
        }

        @Override
        public void run() {
//            RunTestService runTestService = (RunTestService) SpringFactory.getBean("RunTestService");
//            runTestService.quartzJob(jobName);
        }
    }
}
